package com.imooc.rsa;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.servlet.DispatcherType;
import java.util.HashMap;
import java.util.Map;

/**
 * Filter配置
 *
 * @author ruoyi
 */
@Configuration
public class FilterConfig
{

    @Bean
    public FilterRegistrationBean requestDataFilter()
    {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        //自己的过滤器叫什么名字就写上什么名字
        registration.setFilter(new ResponseDataFilter());
        registration.addUrlPatterns("/*");
        registration.setName("responseDataFilter");
        //过滤器的顺序，数字越小，越先执行，反之亦然
        registration.setOrder(FilterRegistrationBean.LOWEST_PRECEDENCE);
        return registration;
    }


}
